package feeinterface.action;

import java.util.Map;

import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.ulwx.tool.RequestUtils;

public class BaseAction extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	// private Logger operlog = Logger.getLogger(this.getClass());
	protected String next;

	/**
	 * 
	 * @param OperaType
	 *            操作类型 1：增加数据 2：修改数据 3：删除数据 4：审批数据 5：查看数据 6：登录与退出
	 * @param OperaDetail
	 *            操作的详细描述
	 */
	public void log(int OperaType, String OperaDetail) {
	}

	public ActionContext getContext() {
		return ActionContext.getContext();
	}
	public Map<String, Object> getSession() {
		ActionContext ctx = ActionContext.getContext();
		return ctx.getSession();
		// ctx.getSession().clear();
	}

	/**
	 * 从请求中取出参数，又将参数放回请求中
	 * 
	 * @param ctx
	 * @return
	 */
	@SuppressWarnings("rawtypes")
	public RequestUtils getRequestUtils() {
		ActionContext ctx = ActionContext.getContext();
		Map<String, Object> rParms = ctx.getParameters();
		RequestUtils ru = new RequestUtils((Map) rParms);
		return ru;
	}

	protected String diff(Object oldobj, Object newobj) {
		return "";
	}

	public String getNext() {
		return next;
	}

	public void setNext(String next) {
		this.next = next;
	}

	 /**
	  * 获取HttpServletResponse对象
	  * 
	  * @return
	  */
	public HttpServletResponse getHttpResponse() {
		HttpServletResponse response = ServletActionContext.getResponse();
		return response;
	}

}
